<?php
    use yii\helpers\Html;
    use yii\web\Response;
    use yii\bootstrap\ActiveForm;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="format-detection" content="telephone=no" />
    <meta name="viewport" content="width=device-width initial-scale=1.0 maximum-scale=1.0 user-scalable=yes" />
		
    <title>★测试★</title>
    <link href="./test/bootstrap.min.css" rel="stylesheet" />
    <link rel="stylesheet" href="./test/style.css" />
    <link href="./test/jquery.mmenu.all.css" rel="stylesheet" />
	<style type="text/css">
body{background:#111302 url("abcd.jpg") top center no-repeat !important;background-size:100% auto !important}body .avatar .img-circle{background:#347433 !important}body form .btn{background:#347433 !important;border-color:#347433 !important}#header h1,#header p{background:none !important}
    </style>
    <script type="text/javascript" src="./test/jquery.min.js"></script>
    <script type="text/javascript" src="./test/bootstrap.min.js"></script>
    <script type="text/javascript" src="./test/jquery.hammer.min.js"></script>
    <script type="text/javascript" src="./test/jquery.mmenu.min.all.js"></script>
    <script src="./test/wxm-core.js"></script> 
</head>
<body id="test1" class="test1">
    <div id="content">
        <div id="header_bar">
        </div>
        <!-- E header_bar -->
	
			
        <div class="container">
            <div id="header" class="text-center">
                <div style="height: 65px;"></div>
				
				 <div class="container">
        <div class="text-center header">
            <h1 class="bold">
                 ★测试★</h1>
            <p>
				
                <span style="padding:4px;background-color: #000;">已有<font color="#FFCC00"><script src="http://news.0579.cn/NewsStatic/Default.aspx?NID=2014072610" charset='utf-8' language="JavaScript" type="text/javascript"></script></font>人参与测试</span>
            </div>
            <!-- E header -->
            <div id="bd" class="panel">
                <div id="panel1" class="panel-body">
                    <form action="#">
                    <div class="form-group avatar text-center">
                        <label for="" class="sr-only">前言</label>
                        <a href="javascript:void(0)" class="img-circle" name="1"><span style="float: left;text-align: center; width: 100%; padding-top: 18px;">
                            <img src="./test/ks.jpg"></span> </a>
                    </div>
                    <dl>
                        <dd>
                            乳房完美度自测</dd>
                    </dl>
                    <div class="buttons">
                        <a href="#result" class="btn btn-lg btn-success" style="width: 100%" onclick="return next(0);">
                            <strong style="color:#fdfd88;">开始测试</strong></a>
                    </div>
                    <div class="buttons" style="margin-top: 10px;">
                        <a href="#" id="weixinfollowlink2" class="btn btn-lg btn-danger" style="width: 100%;
                            background: #0e6796; border-color: #0e6796;">微信关注--青春魔法</strong></a>
                    </div>
                    </form>
                </div>
                <!-- E panel-body -->
                <div id="panel2" class="panel-body js_answer" style="display: none;">
                    <form action="#" method="POST">
                    <a name="result" href="javascript:void(0)"></a>
                    <div class="form-group avatar text-center">
                        <label for="" class="sr-only">
                    前言</label>
                        <a href="javascript:void(0)" class="img-circle" name="1"><span style="float: left;
                            text-align: center; width: 100%; padding-top: 18px;"><img src="./test/ks.jpg"></span> </a>
                    </div>
                    <dl><dd>1.内衣罩杯大小 ？</dd></dl>
                    <ul class="list-group  js_group">
                        <li class="list-group-item" onclick="return toggle(this);">
                            <input name="g" type="radio" class="" value="0" />
                            A.A杯不满 </li>
                        <li class="list-group-item" onclick="return toggle(this);">
                            <input name="g" type="radio" class="" value="1" />
                            B.A杯 </li>
                        <li class="list-group-item" onclick="return toggle(this);">
                            <input name="g" type="radio" class="" value="2" />
                            C.B杯 </li>
                        <li class="list-group-item" onclick="return toggle(this);">
                            <input name="g" type="radio" class="" value="3" />
                            D.C杯</li>
                    </ul>
                    </form>
                </div>
                <!-- E panel-body -->
                <div id="panel2" class="panel-body js_answer" style="display: none;">
                    <form action="#" method="POST">
                    <a name="result" href="javascript:void(0)"></a>
                    <div class="form-group avatar text-center">
                        <label for="" class="sr-only">
                            前言</label>
                        <a href="javascript:void(0)" class="img-circle" name="1"><span style="float: left;
                            text-align: center; width: 100%; padding-top: 18px;">
                            <img src="./test/ks.jpg"></span> </a>
                    </div>
                    <dl>
                        <dd>
                            2.是否有生育、流产或哺乳经历？</dd></dl>
                    <ul class="list-group  js_group">
                        <li class="list-group-item" onclick="return toggle(this);">
                            <input name="g" type="radio" class="" value="0" />
                            A.是 </li>
                        <li class="list-group-item" onclick="return toggle(this);">
                            <input name="g" type="radio" class="" value="3" />
                            B.否</li>
                    </ul>
                    </form>
                </div>
                <!-- E panel-body -->
                <div id="panel2" class="panel-body js_answer" style="display: none;">
                    <form action="#" method="POST">
                    <a name="result" href="javascript:void(0)"></a>
                    <div class="form-group avatar text-center">
                        <label for="" class="sr-only">
                            前言</label>
                        <a href="javascript:void(0)" class="img-circle" name="1"><span style="float: left;
                            text-align: center; width: 100%; padding-top: 18px;">
                            <img src="./test/ks.jpg"></span> </a>
                    </div>
                    <dl>
                        <dd>
                            3.乳房是否有弹性？</dd></dl>
                    <ul class="list-group  js_group">
                        <li class="list-group-item" onclick="return toggle(this);">
                            <input name="g" type="radio" class="" value="3" />
                            A.紧实饱满有弹性 </li>
                        <li class="list-group-item" onclick="return toggle(this);">
                            <input name="g" type="radio" class="" value="0" />
                            B.干瘪松弛无弹性 </li>
                    </ul>
                    </form>
                </div>
                <!-- E panel-body -->
                <div id="panel2" class="panel-body js_answer" style="display: none;">
                    <form action="#" method="POST">
                    <a name="result" href="javascript:void(0)"></a>
                    <div class="form-group avatar text-center">
                        <label for="" class="sr-only">
                            前言</label>
                        <a href="javascript:void(0)" class="img-circle" name="1"><span style="float: left;
                            text-align: center; width: 100%; padding-top: 18px;">
                            <img src="./test/ks.jpg"></span> </a>
                    </div>
                    <dl>
                        <dd>
                            4.乳房下垂度（对照图片）
                        </dd>
                    </dl>
                    <ul class="list-group  js_group">
                        <li class="list-group-item" onclick="return toggle(this);">
                            <input name="g" type="radio" class="" value="3" />
                            A.第一阶段</li>
                        <li class="list-group-item" onclick="return toggle(this);">
                            <input name="g" type="radio" class="" value="2" />
                            B.第二阶段 </li>
                        <li class="list-group-item" onclick="return toggle(this);">
                            <input name="g" type="radio" class="" value="1" />
                            C.第三阶段 </li>
                        <li class="list-group-item" onclick="return toggle(this);">
                            <input name="g" type="radio" class="" value="0" />
                            D.第四阶段 </li>
                    </ul>
                    </form>
                </div>
            <div id="panel2" class="panel-body js_answer" style="display: none; background: #fff">
            	
            	<div id="data-form">
            		<style type="text/css">
            			#data-form input{
            				border-radius:4px;
            				border-radius:4px;
            			}
            			
            		</style>
                    <?php $form = ActiveForm::begin([
                        //'action' => Url::to(['post/save']),           //此处为请求地址 Url用法查看手册
                        'enableAjaxValidation' => true,
                        //'validationUrl' => Url::to(['post/validate']),     //数据异步校验
                    ]);?>
                    <!-- <form class="form-horizontal" action="/post.php" method="post" style="padding-top: 20px;"> -->
                    	<ul class="list-group  js_group">
                    	<li class="list-group-item">
                    		<h3 style="color: black">输入联系方式获取结果吧!</h3>
                    	</li>
                    	<li class="list-group-item">
	                        <div class="control-group">
								<div class="controls">
                                    <?=$form->field($model,'name', ['inputOptions' => ['placeholder'=>'请输入姓名','class' => 'form-control']])->textInput()->label(false);?> 
								</div>
							</div>
						</li>
						<li class="list-group-item">
							<div class="control-group">
								<div class="controls">
								    <?=$form->field($model,'phone', ['inputOptions' => ['placeholder'=>'手机号码','class' => 'form-control']])->textInput()->label(false);?>
								</div>
							</div>
						</li>
						<li class="list-group-item">
							<?=Html::Button('查看结果',['class'=>'btn btn-primary btn-block', 'onclick'=> 'return toggle(this)', 'style' => 'color:#fff']); ?>
						</li>
						</ul>
                        <?php ActiveForm::end(); ?> 
                    <!-- </form> -->

                </div>
            </div>
           
            <div id="panel3" class="panel-body js_result" data-id="0" style="display: none;">
                <h1 class="bold text-danger">
                    0-2分</h1>
                <hr>
                <dl>
                    <dt>详细分析:</dt>
                    <dd>
                        <p>
                            	测试结果：苦瓜衰运胸
                            	★
								现在的你很不顺利吧！因为你有对感觉很倒霉的胸。当然，世上没有解决不了的事，要知道每个女人的胸部并不是一成不变的，重要的是要做好保养，让乳房重塑挺翘饱满。</p>
                    </dd>
                </dl>
            </div>
            <div id="panel3" class="panel-body js_result" data-id="1" style="display: none;">
                <h1 class="bold text-danger">
                    3-5分</h1>
                <hr>
                <dl>
                    <dt>详细分析:</dt>
                    <dd>
                        <p>
                                                                      测试结果：平凡普通胸
                                                                      ★★★
							你的胸目前看来普普通通。你与情人的关系也处在不上不下的阶段。建议你多关注乳房保养，提升乳房形象，展现自己迷人曲线时，就是你超级幸运之时！</p>
                    </dd>
                </dl>
            </div>
            <div id="panel3" class="panel-body js_result" data-id="2" style="display: none;">
                <h1 class="bold text-danger">
                    6-8分</h1>
                <hr>
                <dl>
                    <dt>详细分析:</dt>
                    <dd>
                        <p>
                        	测试结果：普级幸运胸
							★★★★
							很可惜，你差一点就挤进超级幸运胸之列了。不过， 整体来说，你的胸还是不错的（比起平凡普通胸）。建议你平常多注意乳房保养，习惯成自然后，就会使自己的迷人指数上升了。</p>
                    </dd>
                </dl>
            </div>
            <div id="panel3" class="panel-body js_result" data-id="3" style="display: none;">
                <h1 class="bold text-danger">
                    9-12分</h1>
                <hr>
                <dl>
                    <dt>详细分析:</dt>
                    <dd>
                        <p>
                                                                      测试结果：超级幸运胸 
							★★★★★
							恭喜你！现在的你拥有一对超级迷人的幸运胸，紧紧的拴住情人的一对美胸喔！别担心他会移情别恋。至少目前看来，对方是死心蹋地的，建议你好好保护这对倾国倾城的幸运胸。</p>
                    </dd>
                </dl>
            </div>
            <!-- E bd -->
        </div>
        <!-- E container -->
<input type="hidden" name="totalsc" id="totalsc" value="0"  />
<script type="text/javascript">
var total = 5;
var scoreArr = new Array(parseInt(total));
    scoreArr[0] = new Array(2);
    scoreArr[0]['min'] = 0;
    scoreArr[0]['max'] = 2;
    scoreArr[1] = new Array(2);
    scoreArr[1]['min'] = 3;
    scoreArr[1]['max'] = 5;
    scoreArr[2] = new Array(2);
    scoreArr[2]['min'] = 6;
    scoreArr[2]['max'] = 8;
    scoreArr[3] = new Array(2);
    scoreArr[3]['min'] = 9;
    scoreArr[3]['max'] = 12;
var tScore = 0;
var dataForWeixin={
    img:    "",
    url:    "",
    title:  "",
    desc:   "",
};
function next(t){
    $("div#bd > div.panel-body").hide();
    $("div.js_answer").eq(t).show();
    $("div.js_answer").eq(t).children("input").attr("checked","");       
    gotoTop();
}
function result(t){
    share_pop("open",10000);
    $("div#bd > div.panel-body").hide();
    for(var i = 0; i < parseInt(total);i++){
        if(parseInt(t) >= parseInt(scoreArr[i]['min']) && parseInt(t) <= parseInt(scoreArr[i]['max'])){
            $("div.js_result").eq(i).show();
			$("div.js_result").eq(i).find(".resultscore").eq(0).html($("#totalsc").val());
			gotoTop();
		}
        else
            continue;
    }
}
function toggle(t){
    $(t).children("input").attr("checked","checked");
    $("li.list-group-item").removeClass('active');
    var score = $(t).children("input:checked").val();
    if($(t).children("input:checked").val() == undefined){
    	score = 0;
    }
    tScore  = parseInt(tScore) + parseInt(score);
	$("#totalsc").val(tScore);
    $(t).addClass('active');
    var t = $("div.js_answer").index($(t).parents("div.js_answer")) + 1;
    if(t == total){
        $.ajax({
            url: $("#w0").attr('action'),
            type: "POST",
            dataType: "json",
            data: $('#w0').serialize(),
            success: function(Data) {
                if(Data.status)
                    result(tScore);
                else
                    result(tScore);
            },
            error: function() {
                alert('网络错误');
            }
        });
    }else{
        setTimeout(function(){next(t);},500);
    }
}
function gotoTop(){
    $("body,html").animate({scrollTop:($("#header").offset().top + $("#header").height())}, 1000);
}
</script>
</div>
<script type="text/javascript">
$(function() {
	$("input[name='g']").change(function(){
		$("li.list-group-item").removeClass('active')
		$(this).parent("li.list-group-item").addClass('active');
	});
	$('nav#menu-left').mmenu({ dragOpen: true });
	$("nav#menu-right").show();
	var $menu = $('nav#menu-right');
	$menu.mmenu({
		position: 'right',
		classes: 'mm-light',
		dragOpen: true
	});
	$("div.btn-group > a").click(function() {
		$("div.btn-group > a").removeClass("current");
		$(this).addClass("current");
		$("ul.js-right").hide();
		$("ul.js-right").eq($("div.btn-group > a").index(this)).show();
	});
});
</script>

<div id="mcover" onclick="document.getElementById('mcover').style.display='';" style="display: none;"><img src="./test/guide.png"></div>
<script type="text/javascript">
function report(link, action_type){
	var parse_link = parseUrl(link);
	if(parse_link == null){ return; }
	var query_obj = parseParams( parse_link['query_str'] );
	query_obj['action_type'] = action_type;
	query_obj['action_link'] = 'http://www.mycodes.net';
	var report_url = 'report.php?' + jQuery.param( query_obj );
	$.ajax({ url: report_url, type: 'POST', timeout: 2000})
}
function share_scene(link, scene_type){
	var parse_link = parseUrl(link);
	if(parse_link == null){	  return link;	}
	var query_obj = parseParams( parse_link['query_str'] );
	query_obj['scene'] = scene_type;
	var share_url = 'http://' + parse_link['domain'] + parse_link['path'] + '?' + jQuery.param( query_obj ) + (parse_link['sharp'] ? parse_link['sharp'] : '');
	return share_url;
}
function recordscore(t){
	var record_url = 'record.php?t=' + t;
	$.ajax({ url: record_url, type: 'POST', timeout: 2000})
}
$(function(){
    var onBridgeReady=function(){
        WeixinJSBridge.on('menu:share:appmessage', function(argv){
            WeixinJSBridge.invoke('sendAppMessage',{
                "appid":        '',
                "img_url":      dataForWeixin.img,
                "img_width":    "120",
                "img_height":   "120",
                "link":             dataForWeixin.url,
                "desc":             dataForWeixin.desc,
                "title":            dataForWeixin.title+$("#totalsc").val()+" 分 你能超过我吗？ "+dataForWeixin.desc
            }, function(res){
				report(dataForWeixin.url, 1);
				//recordscore($("#totalsc").val());
                shareSuccess();
            });
        });
        WeixinJSBridge.on('menu:share:timeline', function(argv){
			report(dataForWeixin.url, 2);
			//recordscore($("#totalsc").val());
            WeixinJSBridge.invoke('shareTimeline',{
            "img_url":dataForWeixin.img,
            "img_width":"120",
            "img_height":"120",
            "link":dataForWeixin.url,
            "desc":dataForWeixin.desc,
            "title":dataForWeixin.title+$("#totalsc").val()+" 分 你能超过我吗？ "+dataForWeixin.desc
            }, function(res){
                shareSuccess();
            });
        });
        WeixinJSBridge.on('menu:share:weibo', function(argv){
            WeixinJSBridge.invoke('shareWeibo',{
            "content":dataForWeixin.title+$("#totalsc").val()+" 分 你能超过我吗？ "+dataForWeixin.desc+' '+dataForWeixin.url,
            "url":dataForWeixin.url
            }, function(res){
				report(dataForWeixin.url, 3);
				//recordscore($("#totalsc").val());
                shareSuccess();
            });
        });
    };
    if(document.addEventListener){
        document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
            WeixinJSBridge.call('showOptionMenu');
        });
        document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
    }else if(document.attachEvent){
        document.attachEvent('WeixinJSBridgeReady'   , onBridgeReady);
        document.attachEvent('onWeixinJSBridgeReady' , onBridgeReady);
    }
})();
</script>

    <div id="pop_success" class="text-center" style="display: none;">
        <div class="bd text-center">
            <p style="line-height: 110px;">
                分享成功</p>
        </div>
        <!-- E bd -->
    </div>
    <!-- E pop_success -->
    <div id="popup-1" class="tip" style="display: none;">
        <div>
            <a id="close1" href="javascript:void(0)"><i class="glyphicon glyphicon-remove"></i>
            </a>
            <div class="row text-center">
                <a href="#">微信关注：青春魔法</a>
            </div>
            <!-- E discuss -->
        </div>
    </div>
    <!-- E tip -->

    <script>
        $(function() {
            $("a#close1").click(function() {
                share_pop("close", 0);
            });
			if(navigator.userAgent.indexOf("MicroMessenger") == -1){
				$("#weixinfollowlink").attr("href","#");
				$("#weixinfollowlink1").attr("href","#");
				$("#weixinfollowlink2").attr("href","#");
				$("#weixinfollowlink3").attr("href","#");
			}
        });
        function shareSuccess() {
            share_pop("open", 0);
            $("div#pop_success").show().delay(1500).fadeOut("slow");
        }
        function share_pop(t, time) {
            if (t == "open") {
                setTimeout('showShare()', 15000);
            } else {
                $('#follow').hide();
            }
        }
        function showShare() {
            $('#follow').show();
        }
    </script>

</body>
</html>